<?php
//vim:set expandtab tabstop=3 shiftwidth=3 softtabstop=3 foldcolumn=1 foldmethod=marker:
/**
*  Project Name:  5anet
*  File Name   :  config/config.inc.php
*
*  The main configure file
*
*  PHP Version 4 and 5
*
*  @package:      config
*  @author:    Mike.G   Chinese Name: 黄叶 <hylinux@gmail.com>
*  @license:   http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1 
*  @copyright: http://www.5anet.com
*  @version:   $Id: config.inc.php,v 1.4 2006-09-24 14:38:08 ghw Exp $
*  @date:      @Date:$
*/

//define the abs access URL
if ( !defined(ROOT_URL) ) {
   define(ROOT_URL, 'http://www.5anet.com/'); //你的URL存取位置，注意最后的 "/"
}


// define the abs path information
// the root path
if ( !defined(ROOT_PATH) ) {
   define(ROOT_PATH, '/var/www/user/new.5anet.com/docs/'); //你的安装路径, 注意最后的 "/"
}

// the config path
if ( !defined(CONFIG_PATH) ) {
   define(CONFIG_PATH, ROOT_PATH.'config/');
}

// the lib path
if ( !defined(LIB_PATH) ) {
   define(LIB_PATH, ROOT_PATH.'lib/');
}

// the function path
if ( !defined(FUNCTION_PATH) ) {
   define(FUNCTION_PATH, ROOT_PATH.'function/');
}

// the class path
if ( !defined(CLASS_PATH) ) {
   define(CLASS_PATH, ROOT_PATH.'class/');
}

// the lang path
if ( !defined(LANG_PATH) ) {
   define(LANG_PATH, ROOT_PATH.'lang/');
}


// the theme config path
if ( !defined(THEME_CONFIG_PATH) ) {
   define(THEME_CONFIG_PATH, ROOT_PATH.'lang/res/');
}

// the theme compile path
if ( !defined(DATA_CACHE_PATH) ) {
   define(DATA_CACHE_PATH, ROOT_PATH.'cache/');
}

// the theme system delimiter 
if ( !defined(THEME_LEFT_DELIMITER) ) {
   define(THEME_LEFT_DELIMITER, '<{');
}

if ( !defined(THEME_RIGHT_DELIMITER) ) {
   define(THEME_RIGHT_DELIMITER, '}>');
}



// the database information
$db_type = 'mysql';
$db_host = 'localhost';
$db_name = '5anet';
$db_user = 'ghw';
$db_pass = 'aslghw';
$use_persist = 1;
$use_db_debug = 0;

$ADODB_CACHE_DIR = DATA_CACHE_PATH.'adodb/';



//如果用户已经登录，则可以设定用户的一些参数。例如用户的语言
//用户喜欢的桌面，
$user_lang = '';
$user_theme = '';
if ( isset($_SESSION['user']) ) {
   $user_lang = $_SESSION['user']['lang'];
   $user_theme = $_SESSION['user']['theme'];
   $user_time  = $_SESSION['user']['localtime'];
} else {
   if ( $_COOKIE['user'] ) {
      //确认Session里复制一份
      //      $_SESSION['user'] = unserialize(stripslashes($_COOKIE['user']));
      
      $temp_user_info = unserialize(stripslashes($_COOKIE['user']));

      include_once CLASS_PATH.'main/DB.class.php';
      $dbh = DB::getConnection();
      //验证一下这个cookie是否是真实的。
      $temp_user_name = $temp_user_info['name'];
      $temp_user_check = $temp_user_info['check'];

      $sql = 'select count(*) as num from base_user_info where lower(user_name)=? and user_password=? '.
         ' and status=0 ';
      $sth = $dbh->Prepare($sql);
      $res = $dbh->Execute($sth, array(strtolower($temp_user_name), $temp_user_check));
      $rows = $res->FetchRow();

      if ( $rows['num'] ) {
         $_SESSION['user'] = $temp_user_info;
         $user_lang = $_SESSION['user']['lang'];
         $user_theme = $_SESSION['user']['theme'];
         $user_time  = $_SESSION['user']['localtime'];
      }
   }
}

if ( !$user_lang ) {
   $user_lang = 'zh';
}

if ( !$user_theme ) {
   $user_theme = 'default';
}




// the image access URL
if ( !defined(IMAGE_URL) ) {
   define(IMAGE_URL, ROOT_URL.'theme/'.$user_theme.'/images/');
}

// the theme access URL
if ( !defined(THEME_URL) ) {
   define(THEME_URL, ROOT_URL.'theme/'.$user_theme.'/');
}



// the theme path
if ( !defined(THEME_PATH) ) {
   define(THEME_PATH, ROOT_PATH.'theme/'.$user_theme.'/');
}




// define the system language
if ( !defined(SYSTEM_LANG) ) {
   define(SYSTEM_LANG, $user_lang);
}

// website email
define('WEBSITE_EMAIL', 'hylinux@gmail.com');

//定义可视化web编辑器的参数
define('FCKEDITOR_BASEPATH', "/lib/fckeditor/");
define('FCKEDITOR_UPLOADDIR', "/upload/fckeditor/");


?>
